package bavaria.hightech.b2b;

import java.util.HashMap;
import java.util.Map;


public class BankRegistry implements AssignEvent{
	
	private Map<String, B2B> bankMap;
	private static BankRegistry theInstance;
	
	
	private BankRegistry(){
		bankMap = new HashMap<String, B2B>();
		
	}
	
	public static BankRegistry getInstance(){
		if(theInstance == null)
			theInstance = new BankRegistry();
		return theInstance;
	}
	
	
	public void bind(String name, B2B bank){
		this.bankMap.put(name, bank);		
	}
	
	public B2B lookup(String name){
		return bankMap.get(name);
		
	}

	@Override
	public B2B assignEvent(String bankName) {
		return lookup(bankName);
	}

}
